<template>
	<view>
		<view class="header status_bar" :class="scrrol == true ? 'scrrolHeader' : ''">
			<!-- <view class="back iconfont icon-xiangzuo1" @tap="backPage"></view> -->
			<view class="text" :class="scrrol == true ? 'scrrolHeader' : ''">车界网</view>
		</view>	
		<view class="bg_box">
			<image class="bg01" :src="getImgSrc('/static/bg05.png')" mode="widthFix"></image>
			<view class="bg_content">
				<view class="service_box">
					<view class="service" :data-url="'/pages/service/publish01'" @click="gotopage">
						<view class="icon iconfont icon-mianfeifache"></view>
						<view class="text">免费发车</view>
					</view>
					<view class="service" :data-url="'/pages/service/buy'" @click="gotopage">
						<view class="icon iconfont icon-qiugoucheyuan"></view>
						<view class="text">求购大厅</view>
					</view>
				</view>
				
				<view class="page_title">
					<view class="title">更多服务</view>
					<!-- <view class="arrow iconfont icon-xiangyou1"></view> -->
				</view>
				
				<view class="service_other">
					<view class="service" :data-url="'/pages/index/records?title=' + '出险查询&type=1'" @click="gotopage">
						<image src="../../static/bg13.png" mode="widthFix"></image>
						<view class="service_content">
							<view class="title">出险查询</view>
							<view class="text">车信盟出险查询</view>
						</view>
					</view>
					<view class="service" :data-url="'/pages/index/records?title=' + '维保记录&type=0'" @click="gotopage03">
						<image src="../../static/bg14.png" mode="widthFix"></image>
						<view class="service_content">
							<view class="title">维保记录</view>
							<view class="text">4s维保记录</view>
						</view>
					</view>
					<!-- <view class="service" :data-url="'/pages/index/records?title=' + '综合查询&type=6'" @click="gotopage">
						<image src="../../static/bg15.png" mode="widthFix"></image>
						<view class="service_content">
							<view class="title">综合查询</view>
							<view class="text">出险+维保</view>
						</view>
					</view> -->
					<view class="service" :data-url="'/pages/index/records?title=' + '里程查询&type=2'" @click="gotopage">
						<image src="../../static/bggl.png" mode="widthFix"></image>
						<view class="service_content">
							<view class="title">里程查询</view>
							<view class="text">公里数查询</view>
						</view>
					</view>
					<view class="service" :data-url="'/pages/index/records?title=' + '电池查询&type=7'" @click="gotopage">
						<image src="../../static/bgdc.png" mode="widthFix"></image>
						<view class="service_content">
							<view class="title">电池查询</view>
							<view class="text">查询电池寿命</view>
						</view>
					</view>
					<view class="service" :data-url="'/pages/circle/circle'" @click="gotopage02">
						<image src="../../static/bg16.png" mode="widthFix"></image>
						<view class="service_content">
							<view class="title">发朋友圈</view>
							<view class="text">自动发布</view>
						</view>
					</view>
				</view>
				
			</view>
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				page:1,
				scrrol:false,
				info:'',
				
			}
		},
		onLoad() {

		},
		methods: {
			setRule(e){
				let that = this;
				let index = e.currentTarget.dataset.index;
				that.flowList[index].tick = !that.flowList[index].tick
			},
			loadData() {
				let that = this;
			// 	that.Net._get('shop_home', {}, res => {
			// 		if (res.code == 200) {
			// 			//console.log(res);
			
			// 		}
			// 	});
			},
			backPage() {
				uni.navigateBack({});
			},
			gotopage(e) {
				let url = e.currentTarget.dataset.url;
				uni.navigateTo({
					url: url
				});
			},
			gotopage02(e) {
				let url = e.currentTarget.dataset.url;
				uni.switchTab({
					url: url
				});
			},
			
			gotopage03(e) {
				let currentDate = new Date(); // 创建Date对象，返回当前日期和时间
				let currentTime = currentDate.getTime(); // 获取当前时间的时间戳
				let start_time = this.getTodayAtNineTimestamp(9);
				let end_time = this.getTodayAtNineTimestamp(18);
				if (currentTime < start_time || currentTime > end_time){
					this.Msg.Fail('亲，维保查询时间为09:00-18:00，若在范围外请次日进行查询~');
					return false;
				}
				let url = e.currentTarget.dataset.url;
				uni.navigateTo({
					url: url
				});
			},
			getTodayAtNineTimestamp(hour) {
				const now = new Date();
				const year = now.getFullYear();
				const month = now.getMonth() + 1; // 月份是从0开始的，所以需要+1
				const day = now.getDate();
				const targetHour = hour; // 目标时间为9点
				const targetMinutes = 0; // 分钟设置为0
				const targetSeconds = 0; // 秒设置为0
				const targetDate = new Date(year, month - 1, day, targetHour, targetMinutes, targetSeconds);
				return targetDate.getTime();
			}
		},
		onPageScroll: function(Object) {
			//console.log(Object.scrollTop); //实时获取到滚动的值
			if (Object.scrollTop > 28) {
				this.scrrol = true;
				/* #ifdef APP-PLUS */
				/* #endif */
			} else if (Object.scrollTop < 28) {
				this.scrrol = false;
				/* #ifdef APP-PLUS */
				/* #endif */
			}
		},
		onReachBottom() {
		  var that = this;
		  that.page++;
		  // that.Net._get('shop_goods', {per_page:'10',page:that.page,}, res => {
		  //   if (res.code == 200) {
		  //     //console.log(res)
		  //     if (res.data.data == '') {
		  //       uni.showToast({
		  //         title: '已经是最后一页了',
		  //         duration: 2000,
		  //         icon: 'none'
		  //       });
		  //     } else {
		  //       that.info = that.info.concat(res.data.data); //将数据拼接在一起
		  //     }
		  //   } else if (res.code == 0) {
		  //     that.Msg.Success(res.msg, res => {});
		  //   }
		  // });
		},
	}
</script>

<style>
	
	.header{
		background-color: transparent !important;
		background-color: #FC5D20 !important;
		height: 20vw !important;
	}
	
	.header .text{
		background-color: transparent !important;
	}
	
	.scrrolHeader{
		background-color: #F9E9E3 !important;
	}
	
	.bg_box{
		width: 100%;
		position: relative;
	}
	
	.bg_box .bg01{
		width: 100%;
	}
	
	.bg_box .bg_content{
		width: 92%;
		position: absolute;
		left: calc(50% - 46%);
		top: calc(13.5vw + var(--status-bar-height));
		z-index: 98;
	}
	
	.service_box{
		width: 100%;
		display: flex;
		align-items: center;
		margin-top: 7vw;
	}
	
	.service_box .service{
		flex: 1;
		margin-left: 4%;
		padding: 4vw 0;
		border-radius: 3vw;
	}
	
	.service_box .service:nth-child(1){
		margin-left: 0;
		background-color: #FF5139;
	}
	
	.service_box .service:nth-child(2){
		background-color: #FE9029;
	}
	
	.service_box .service .icon{
		font-size: 6.5vw;
		color: #fff;
		text-align: center;
	}
	
	.service_box .service .text{
		font-size: 4.5vw;
		color: #fff;
		font-weight: bold;
		text-align: center;
		margin-top: 2vw;
	}
	
	.page_title{
		width: 100%;
		margin-top: 4%;
		display: flex;
		align-items: center;
	}
	
	.page_title .title{
		font-size: 4.5vw;
		color: #333;
		font-weight: bold;
		flex: 1;
	}
	
	.page_title .arrow{
		font-size: 4vw;
		color: #999;
	}
	
	.service_other{
		width: 100%;
		display: flex;
		flex-direction: row;
		justify-content: left;
		flex-wrap: wrap;
	}
	
	.service_other::after {
		flex: auto;
		content: '';
	}
	
	.service_other .service{
		width: 48%;
		margin-left: 4%;
		position: relative;
		margin-top: 4%;
	}
	
	.service_other .service:nth-child(2n + 1){
		margin-left: 0;
	}
	
	.service_other .service image{
		width: 100%;
	}
	
	.service_other .service .service_content{
		width: 100%;
		height: 100%;
		position: absolute;
		left: 0;
		top: 0;
		padding: 4vw;
	}
	
	.service_other .service .service_content .title{
		font-size: 4vw;
		color: #333;
		font-weight: bold;
	}
	
	.service_other .service .service_content .text{
		font-size: 3vw;
		color: #FE9129;
		margin-top: 2vw;
	}
	
	
	
	
</style>
